#include "mem/LineFlags.h"
#include <cstdio>

NEW_DELETE_OPERATORS_CPP(LineFlags, 300);

bool LineFlags::ltFunctor (LineFlags* y) {
    LineFlagsAddrLessThan c;
    return c(this, y);
}

bool LineFlags::eqFunctor (LineFlags* y) {
    LineFlagsAddrEquals c;
    return c(this, y);
}

char const * LineFlags::str () const {
        char * buf = const_cast<char*>(str_buffer);
        buf[0] = '\0';
        appendStrForm(buf, sizeof(str_buffer));
        buf[sizeof(str_buffer) - 1] = '\0';
        return str_buffer;
}

int LineFlags::appendStrForm(char * buf, int avail) const {
    return snprintf(buf, avail, "V:%d,D:%d", isValid(), isDirty());
}
